package cn.pattern.demo6;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * 代理类要做的事情
 * @auth wzy
 * @date 2023/10/10 17:24
 */
public class IntermediaryMethodInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        System.out.println("ProxyBuyer看房前。。。");
        // 核心业务
        Object result = methodProxy.invokeSuper(proxy, args);
        System.out.println("ProxyBuyer看房后。。。");

        return result;
    }
}
